import axios from "axios";
import config from "@/config";
import qs from "qs";

axios.defaults.baseURL = config.baseURL;
axios.defaults.timeout = 60000;
axios.defaults.withCredentials = true;
axios.defaults.headers.post["Content-Type"] =
  "application/x-www-form-urlencoded";
axios.defaults.transformRequest = [
  function(data, headers) {
    //return a string or an axios of Buffer, ArrayBuffer,FormData or Stream
    //return JSON.stringify(data);
    return qs.stringify(data);
    //return data;
  }
];

export default axios;
